package com.chuanke.ckfamily.service.social;

import com.chuanke.ckfamily.dao.base.Page;
import com.chuanke.ckfamily.dao.social.model.Family;
import com.chuanke.ckfamily.dao.social.model.FamilyMember;
import com.chuanke.ckfamily.dao.user.model.User;
import com.chuanke.ckfamily.service.exception.CFException;
import com.chuanke.ckfamily.service.exception.FamilyExcepiton;
import com.weijie.core.IBaseBiz;

import org.apache.http.ParseException;

import java.io.IOException;
import java.util.List;
import java.util.Map;

public interface FamilyMemberService extends IBaseBiz<FamilyMember> {

	/**
	 * 获取家族前几名，第一名为族长
	 *
	 * @param familId
	 * @return
	 * @throws CFException
	 */
	List<User> getTopMembers(Long familId) throws CFException;

	/**
	 * 获取家族成员
	 *
	 * @param familyId
	 * @return
	 */
	List<User> getMembers(Long familyId);

	/**
	 * 未加入本家族并且不是族长的粉丝
	 * @param userId
	 * @param page
	 * @param tid
	 * @return
	 * @throws CFException
	 */
	List<User> getCanAddMember(Long userId, String nickName, Page page, String tid)throws CFException;

	/**
	 * 根据用户id查找成员
	 *
	 * @param userId
	 * @return
	 */
	FamilyMember findByUserId(Long userId);

	Integer searchCountByFamilyId(Long familyId);

	/**
	 * 用户拉粉丝入家族
	 *
	 * @param uid
	 * @param fanList
	 * @param oneKey
	 * @param tid 
	 * @throws Exception 
	 */
	int addFamilyMembers(Long uid, List<String> fanList, Boolean oneKey, String tid) throws CFException;

	/**
	 * 增加家族成员
	 *
	 * @param family
	 * @param user
	 * @param saveToWy
	 * @param auto 自动拉
	 * @throws CFException
	 * @throws Exception 
	 */
	boolean addFamilyMember(Family family, User user, boolean saveToWy, boolean auto) throws CFException;

	/**
	 * 增加家族成员
	 *
	 * @param family
	 * @param users
	 * @param auto 自动
	 */
	int addFamilyMembers(Family family, List<User> users, boolean auto) throws CFException;

	/**
	 * 踢人出家族的功能
	 * 只有家族成员三天不登陆时，族长才可以把他踢掉。
	 *
	 * @param ownerId
	 * @param tid 
	 * @param members
	 *
	 * @return
	 * @throws CFException
	 * @throws Exception 
	 * @throws IOException
	 * @throws ParseException
	 */
	int kickFamilyMember(Long ownerId, List<String> members, String tid) throws CFException, Exception;

	/**
	 * 退出家族的功能
	 * 当族长3天不登陆时，用户可选择退出家族。
	 * 族长不可以退出家族
	 *
	 * @param uid 用户id
	 * @param force 强制退出
	 * @param tid 
	 * @param aotuAdd 
	 *
	 * @return
	 * @throws CFException
	 * @throws IOException
	 * @throws ParseException
	 */
	boolean leaveFamily(Long uid, boolean force, String tid) throws CFException, Exception;

	/**
	 * 家族族长 禁言：立即禁言
	 * 家族成员 禁言 ：统计180秒内点击禁言此用户的人数，如果达到5人，执行禁言。
	 *
	 * @param userId
	 * @param tuserId
	 * @param tid 
	 *
	 * @return
	 * @throws CFException
	 * @throws IOException
	 * @throws ParseException
	 */
	Map<String, Object>  muteFamilyMember(Long userId, Long tuserId, String tid) throws CFException, ParseException, IOException;

	/**
	 *解除禁言
	 *禁言解除需要族长操作。
	 *
	 * @param userId
	 * @param tid 
	 * @param tuserId
	 * @param tid 
	 *
	 * @return
	 * @throws CFException
	 * @throws IOException
	 * @throws ParseException
	 */
	Map<String, Object>  unMuteFamilyMember(Long userId, Long tuserId, String tid) throws CFException, ParseException, IOException;

	Map<String,Object> shieldFamily(Long uid, String tid, Integer shield)throws CFException;

	Map<String, Object> getMember(Long uid, String tid) throws CFException;

	void checkFamilyMember() throws ParseException, IOException, CFException;

	Map<String, Object> updateMsgTime(Long uid, String tid) throws  CFException;

	Map<String, Object> getMsgTime(Long uid, String tid) throws CFException;
	
	

}